package com.example.javabasic.shejimoshi.beiwanglu.demo1;

//发起人
public class Originator {
    //状态
    private String state;


    public void setState(String state) {
        this.state = state;
    }

    public String getState() {
        return state;
    }

    //创建备忘录
    public Memento createMemento() {
        return new Memento(state);
    }

    //恢复状态
    public void restoreMemento(Memento memento) {
        this.setState(memento.getState());
    }
}
